// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import myajax from '@/assets/myfetch'
import Alert from '@/components/alert/index'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
// import socketio from 'socket.io-client'
// let href=location.origin.indexOf("3000")!=-1?location.origin:location.origin+":3000"
// Vue.prototype.$io = socketio(href, {
//   reconnection: false, //关闭自动重连
// })

Vue.prototype.$axios = axios;
Vue.use(ElementUI);
Vue.config.productionTip = false
Vue.prototype.$myajax = myajax

router.beforeEach((to, from, next) => {
  document.documentElement.style = ""
  if(!localStorage.getItem("haust-twxsh-token") && to.path!=="/"){
      next("/?path="+to.path)
  }
  console.log(from,to)
  next()
})

Vue.use(Alert);
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
})
